<!DOCTYPE html>
<html lang="zh-cn">
   <head>
      <meta charset="utf-8">
      <meta http-equiv="X-UA-Compatible" content="IE=edge">
      <meta name="viewport" content="width=device-width, initial-scale=1">
      <title>{$CONF['mallTitle']}后台管理中心</title>
      <link href="__PUBLIC__/plugins/bootstrap/css/bootstrap.min.css" rel="stylesheet">
      <link href="__ROOT__/Apps/Admin/View/css/AdminLTE.css" rel="stylesheet" type="text/css" />
      <link rel="stylesheet" href="__ROOT__/Apps/Admin/View/css/daterangepicker/daterangepicker-bs3.css">
      <link href="__ROOT__/Apps/Admin/View/css/upload.css" rel="stylesheet" type="text/css" />
      <link rel="stylesheet" type="text/css" href="__PUBLIC__/plugins/webuploader/webuploader.css" />
      <!--[if lt IE 9]>
      <script src="__PUBLIC__/js/html5shiv.min.js"></script>
      <script src="__PUBLIC__/js/respond.min.js"></script>
      <![endif]-->
      <script src="__PUBLIC__/js/jquery.min.js"></script>
      <script src="__PUBLIC__/plugins/bootstrap/js/bootstrap.min.js"></script>
      <script src="__ROOT__/Apps/Admin/View/js/daterangepicker.js"></script>
      <script src="__PUBLIC__/js/common.js"></script>
      <script src="__PUBLIC__/plugins/plugins/plugins.js"></script>
      <script src="__PUBLIC__/plugins/formValidator/formValidator-4.1.3.js"></script>
      <script type="text/javascript" src="__ROOT__/Apps/Admin/View/js/upload.js"></script>
      <script type="text/javascript" src="__PUBLIC__/plugins/webuploader/webuploader.js"></script>
      <script src="__PUBLIC__/plugins/layer/layer.min.js"></script>
   </head>
   <script>
   $(function () {
	   $.formValidator.initConfig({
		   theme:'Default',mode:'AutoTip',formID:"myform",debug:true,submitOnce:true,onSuccess:function(){
				   edit();
			       return false;
			},onError:function(msg){
		}});
	  
	   $("#positionName").formValidator({empty:false,onFocus:"请输入位置名称"}).inputValidator({min:1,onError: "请输入位置名称"});
   });
   
   function edit(){
	   var params = WST.fillForm('.ipt');
	   if(parseInt(params.positionWidth,10)<=0){
		   Plugins.Tips({title:'信息提示',icon:'error',content:'建议宽度必须大于0!',timeout:1000});
		   return;
	   }
	   if(parseInt(params.positionHeight,10)<=0){
		   Plugins.Tips({title:'信息提示',icon:'error',content:'建议高度必须大于0!',timeout:1000});
		   return;
	   }
	   Plugins.waitTips({title:'信息提示',content:'正在提交数据，请稍后...'});
		$.post("{:U('Admin/AdPositions/edit')}",params,function(data,textStatus){
			var json = WST.toJson(data);
			if(json.status=='1'){
				Plugins.setWaitTipsMsg({ content:'操作成功',timeout:1000,callback:function(){
				   location.href='{:U("Admin/AdPositions/index")}';
				}});
			}else{
				Plugins.closeWindow();
				Plugins.Tips({title:'信息提示',icon:'error',content:'操作失败!',timeout:1000});
			}
		});
   }
   </script>
   <body class="wst-page">
   
       <form name="myform" method="post" id="myform" autocomplete="off">
        <input type='hidden' id='id' class='ipt' value='{$object.positionId}'/>
        <table class="table table-hover table-striped table-bordered wst-form">
           <tr>
             <th align='right'>位置类型<font color='red'>*</font>：</th>
             <td>
             <select id='positionType' class='ipt'>
                <option value=''>请选择</option>
                <option value='0' <if condition="$object['positionType'] == 0 ">selected</if>>PC版</option>
                <if condition="$CONF['isOpenWeiXin'] == 1 ">
                <option value='2' <if condition="$object['positionType'] == 2 ">selected</if>>微信版</option>
                </if>
             </select>
             </td>
           </tr>
           <tr>
             <th width='120' align='right'>位置名称<font color='red'>*</font>：</th>
             <td><input type='text' id='positionName' class="form-control wst-ipt ipt" value='{$object.positionName}' maxLength='30'/></td>
           </tr>
           <tr>
             <th align='right'>建议宽度<font color='red'>*</font>：</th>
             <td>
             <input type='text' id='positionWidth' class="form-control ipt" style='width:100px' value='{$object.positionWidth}' onkeypress="return WST.isNumberKey(event)" onkeyup="javascript:WST.isChinese(this,1)" maxLength='7'/>
             </td>
           </tr>
           <tr>
             <th align='right'>建议高度<font color='red'>*</font>：</th>
             <td>
             <input type='text' id='positionHeight' class="form-control ipt" style='width:100px' value='{$object.positionHeight}' onkeypress="return WST.isNumberKey(event)" onkeyup="javascript:WST.isChinese(this,1)" maxLength='7'/>
             </td>
           </tr>
           <tr>
             <td colspan='2' style='padding-left:250px;'>
                 <button type="submit" class="btn btn-success">保&nbsp;存</button>
                 <button type="button" class="btn btn-primary" onclick='javascript:location.href="{:U('Admin/AdPositions/index')}"'>返&nbsp;回</button>
             </td>
           </tr>
        </table>
       </form>
   </body>
</html>